import request from '@/utils/request'

// 获取售后申请列表
export function getAfterSaleList(params) {
  return request({
    url: '/after-sale/list',
    method: 'get',
    params
  })
}

// 获取售后申请详情
export function getAfterSaleDetail(id) {
  return request({
    url: `/after-sale/detail/${id}`,
    method: 'get'
  })
}

// 处理售后申请
export function processAfterSale(data) {
  return request({
    url: '/after-sale/process',
    method: 'post',
    data
  })
}

// 批量处理售后申请
export function batchProcessAfterSale(data) {
  return request({
    url: '/after-sale/batch-process',
    method: 'post',
    data
  })
}

// 获取售后处理记录
export function getAfterSaleHistory(id) {
  return request({
    url: `/after-sale/history/${id}`,
    method: 'get'
  })
}

// 导出售后数据
export function exportAfterSaleData(params) {
  return request({
    url: '/after-sale/export',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// 更新售后状态
export function updateAfterSaleStatus(data) {
  return request({
    url: '/after-sale/status',
    method: 'put',
    data
  })
}

